home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / editors / emcs1855 / emcs1855.0 / lisp / icon.elc < prev    next >
Encoding:
Text File  |  1988-05-03  |  10.6 KB  |  145 lines

  1.  
  2. (defvar icon-mode-abbrev-table nil "\
  3. Abbrev table in use in Icon-mode buffers.")
  4.  
  5. (define-abbrev-table (quote icon-mode-abbrev-table) nil)
  6.  
  7. (defvar icon-mode-map nil "\
  8. Keymap used in Icon mode.")
  9.  
  10. (if icon-mode-map nil (setq icon-mode-map (make-sparse-keymap)) (define-key icon-mode-map "{" (quote electric-icon-brace)) (define-key icon-mode-map "}" (quote electric-icon-brace)) (define-key icon-mode-map "✓" (quote mark-icon-function)) (define-key icon-mode-map "⇧" (quote beginning-of-icon-defun)) (define-key icon-mode-map "❎" (quote end-of-icon-defun)) (define-key icon-mode-map "①" (quote indent-icon-exp)) (define-key icon-mode-map "" (quote backward-delete-char-untabify)) (define-key icon-mode-map "    " (quote icon-indent-command)))
  11.  
  12. (defvar icon-mode-syntax-table nil "\
  13. Syntax table in use in Icon-mode buffers.")
  14.  
  15. (if icon-mode-syntax-table nil (setq icon-mode-syntax-table (make-syntax-table)) (modify-syntax-entry 92 "\\" icon-mode-syntax-table) (modify-syntax-entry 35 "<" icon-mode-syntax-table) (modify-syntax-entry 10 ">" icon-mode-syntax-table) (modify-syntax-entry 36 "." icon-mode-syntax-table) (modify-syntax-entry 47 "." icon-mode-syntax-table) (modify-syntax-entry 42 "." icon-mode-syntax-table) (modify-syntax-entry 43 "." icon-mode-syntax-table) (modify-syntax-entry 45 "." icon-mode-syntax-table) (modify-syntax-entry 61 "." icon-mode-syntax-table) (modify-syntax-entry 37 "." icon-mode-syntax-table) (modify-syntax-entry 60 "." icon-mode-syntax-table) (modify-syntax-entry 62 "." icon-mode-syntax-table) (modify-syntax-entry 38 "." icon-mode-syntax-table) (modify-syntax-entry 124 "." icon-mode-syntax-table) (modify-syntax-entry 39 "\"" icon-mode-syntax-table))
  16.  
  17. (defconst icon-indent-level 4 "\
  18. *Indentation of Icon statements with respect to containing block.")
  19.  
  20. (defconst icon-brace-imaginary-offset 0 "\
  21. *Imagined indentation of a Icon open brace that actually follows a statement.")
  22.  
  23. (defconst icon-brace-offset 0 "\
  24. *Extra indentation for braces, compared with other text in same context.")
  25.  
  26. (defconst icon-continued-statement-offset 4 "\
  27. *Extra indent for lines not starting new statements.")
  28.  
  29. (defconst icon-continued-brace-offset 0 "\
  30. *Extra indent for substatements that start with open-braces.
  31. This is in addition to icon-continued-statement-offset.")
  32.  
  33. (defconst icon-auto-newline nil "\
  34. *Non-nil means automatically newline before and after braces,
  35. and after colons and semicolons, inserted in C code.")
  36.  
  37. (defconst icon-tab-always-indent t "\
  38. *Non-nil means TAB in Icon mode should always reindent the current line,
  39. regardless of where in the line point is when the TAB command is used.")
  40.  
  41. (defun icon-mode nil "\
  42. Major mode for editing Icon code.
  43. Expression and list commands understand all Icon brackets.
  44. Tab indents for Icon code.
  45. Paragraphs are separated by blank lines only.
  46. Delete converts tabs to spaces as it moves back.
  47. \\{icon-mode-map}
  48. Variables controlling indentation style:
  49.  icon-tab-always-indent
  50.     Non-nil means TAB in Icon mode should always reindent the current line,
  51.     regardless of where in the line point is when the TAB command is used.
  52.  icon-auto-newline
  53.     Non-nil means automatically newline before and after braces
  54.     inserted in Icon code.
  55.  icon-indent-level
  56.     Indentation of Icon statements within surrounding block.
  57.     The surrounding block's indentation is the indentation
  58.     of the line on which the open-brace appears.
  59.  icon-continued-statement-offset
  60.     Extra indentation given to a substatement, such as the
  61.     then-clause of an if or body of a while.
  62.  icon-continued-brace-offset
  63.     Extra indentation given to a brace that starts a substatement.
  64.     This is in addition to icon-continued-statement-offset.
  65.  icon-brace-offset
  66.     Extra indentation for line if it starts with an open brace.
  67.  icon-brace-imaginary-offset
  68.     An open brace following other text is treated as if it were
  69.     this far to the right of the start of its line.
  70.  
  71. Turning on Icon mode calls the value of the variable icon-mode-hook with no args,
  72. if that value is non-nil." (interactive) (byte-code "עêפ êצ✓!êקë①êרë②ê ë③êש
  73. !êתה!êן◆Pë⑥╱êתז!ê╱ë⑥✓êתח!êךë⑥    êתט!êיë⑥
  74. êתכ!êםë⑥ êתל!êףë⑥
  75. êתמ!êץë⑥êתנ!ê§ë⑥êתס!ê∧ë⑥⓪ê∞α!ç" [icon-mode-map major-mode mode-name local-abbrev-table icon-mode-abbrev-table icon-mode-syntax-table paragraph-start page-delimiter paragraph-separate indent-line-function require-final-newline t comment-start comment-end comment-column comment-start-skip comment-indent-hook nil kill-all-local-variables use-local-map icon-mode "Icon" set-syntax-table make-local-variable "^$\\|" icon-indent-line "# " "" 32 "# *" icon-comment-indent run-hooks icon-mode-hook] 14))
  76.  
  77. (defun icon-comment-indent nil (byte-code "IJא!â
  78. בé④èגד!êiT✓])ç" [comment-column looking-at "^#" 0 skip-chars-backward "     "] 4))
  79.  
  80. (defun electric-icon-brace (arg) "\
  81. Insert character and correct line's indentation." (interactive "P") (byte-code "גêג⑧    ?à&là&èהו!ên)å&
  82. â%ז êח êבé&גàL
  83. cêז ê
  84. à>ח ê`טZë⓪êז êè✓àG✓Tbêיכ!)ê✓â^è✓bêלמ    !!)écלמ    !!)ç" [insertpos arg icon-auto-newline t nil last-command-char skip-chars-backward "     " icon-indent-line newline 2 delete-char -1 self-insert-command prefix-numeric-value] 12))
  85.  
  86. (defun icon-indent-command (&optional whole-exp) (interactive "P") (byte-code "דêהê✓â?ו דדə⑨è à⑥ז ê`ë②êחט!ê`ë③ê
  87. bêיט!ê`ë②)ê♪
  88. Và;כ
  89. ♪    ל$+éV ?àLèמנ!ên?)âTס éVו ç" [whole-exp shift-amt beg end icon-tab-always-indent nil "Indent current line as Icon code, or in some cases insert a tab character.
  90. If icon-tab-always-indent is non-nil (the default), always indent current line.
  91. Otherwise, indent the current line only if point is at the left margin
  92. or in the line's indentation; otherwise insert a tab.
  93.  
  94. A numeric argument, regardless of its value,
  95. means indent rigidly all the lines of the expression starting after point
  96. so that this line becomes properly indented.
  97. The relative indentation among the lines of the expression are preserved." icon-indent-line beginning-of-line forward-sexp 1 forward-line indent-code-rigidly "#" skip-chars-backward "     " insert-tab] 9))
  98.  
  99. (defun icon-indent-line nil "\
  100. Indent current line as Icon code.
  101. Return the amount the indentation changed by." (byte-code "חIJ!IJIJIJd`Zə⑧ט ê`ë②ê✓IJ=â\"י ë⓪éâ✓ה=â/כ ë⓪éâלמ!â;נë⓪éâסע!ê✓<àH✓@ë⓪êלפ!àSלצ!?âbèק êי )ë⓪éâgרUåkלש!âw✓◆Zë⓪éâgתUàâ✓✓\\ë⓪êסע!ê✓iZë③êן♪!âúd
  102. Z`Vàád
  103. ZbéÃך
  104. `\"ê✓jêd
  105. Z`VàÃd
  106. Zbê♪-ç" [indent nil beg shift-amt case-fold-search pos t icon-indent-level icon-brace-offset calculate-icon-indent beginning-of-line current-indentation calculate-icon-indent-within-comment looking-at "[     ]*#" 0 skip-chars-forward "     " "else\\b" "else\\s_" icon-backward-to-start-of-if 125 "end\\b" 123 zerop delete-region] 16))
  107.  
  108. (defun calculate-icon-indent (&optional parse-start) "\
  109. Return appropriate indentation for current line as Icon code.
  110. In usual case returns an integer: the column to indent to.
  111. Returns nil if line starts inside a string, t if in a comment." (byte-code "èל ê`אאאא⑨⑧╱â⑨╱béמ ë⑤ê`✓Wà:`ë⑥╱êנ`✓ס#ë③ê♪A@ë④êéêע♪8åDפ♪8âMפ♪8é✓⇧ àVצ fק\"âa Tbêié✓⇧
  112. âwרe!êש âs✓étסé✓⇧ ?àéמ ê`ë④ê✓bêר !êש âãת !êן✓iè✓bêךם!êgק=)â½    é¼ס#é✓⇧ bêèףץ!âij§ע!éב∧∞!êךα!êףβ!àרΓ∞!êéגê`✓Wà§i)å✓⇧ןnàΩπ
  113. !â⌡♪✓\\é≈
  114. Σם!ênâ⇨⇧סé❎⇧ σ #-)ç" [indent-point case-fold-search nil state containing-sexp toplevel parse-start t icon-continued-statement-offset icon-continued-brace-offset icon-indent-level icon-brace-offset icon-brace-imaginary-offset beginning-of-line beginning-of-icon-defun parse-partial-sexp 0 3 4 /= 123 icon-backward-to-noncomment icon-is-continuation-line icon-backward-to-start-of-continued-exp + skip-chars-forward "     " looking-at "procedure\\s " forward-sexp forward-char 1 "     
  115. " "#" forward-line zerop skip-chars-backward current-indentation] 25))
  116.  
  117. (defun icon-is-continuation-line nil (byte-code "h⑧א✓!⑨    ב=âגדהו!ê`הז!ê`\"ח\"é\"✓ט>?*ç" [ch ch-syntax char-syntax 119 assoc buffer-substring forward-word -1 1 (("do") ("dynamic") ("else") ("initial") ("link") ("local") ("of") ("static") ("then")) (0 59 125 123 41 93 34 39 10)] 7))
  118.  
  119. (defun icon-backward-to-noncomment (lim) (byte-code "גג⑨⑧    ?à0דה
  120. \"ê`ë⓪êו êזח✓ט#à 
  121. `Wâ)יכ!é,בë①êé⇦*ç" [opoint stop lim t nil skip-chars-backward "     
  122. " beginning-of-line search-forward "#" move forward-char -1] 7))
  123.  
  124. (defun icon-backward-to-start-of-continued-exp (lim) (byte-code "hIJ>à    אב!êג à⑥דה!êé
  125. êו ê`✓Xà#✓Tbêזח!ç" [lim (41 93) forward-sexp -1 icon-is-continued-line end-of-line 0 beginning-of-line skip-chars-forward "     "] 6))
  126.  
  127. (defun icon-is-continued-line nil (byte-code "èijIJ!êא )ç" [end-of-line 0 icon-is-continuation-line] 3))
  128.  
  129. (defun icon-backward-to-start-of-if (&optional limit) "\
  130. Move to the start of the last ``unbalanced'' if." (byte-code "✓å èג ê`)ë⓪êדבə⑨ה    !?àFוד!êזח!â)    Të①éBזט!â6    Së①éB`✓WàBיë①ê✓bêé①*ç" [limit if-level case-fold-search nil beginning-of-icon-defun 1 zerop backward-sexp looking-at "else\\b" "if\\b" 0] 8))
  131.  
  132. (defun mark-icon-function nil "\
  133. Put mark at end of Icon function, point at beginning." (interactive) (byte-code "ijêIJ`!êא êIJ`!êבג!êד ç" [nil push-mark end-of-icon-defun beginning-of-line 0 beginning-of-icon-defun] 6))
  134.  
  135. (defun beginning-of-icon-defun nil "\
  136. Go to the start of the enclosing procedure; return t if at top level." (interactive) (byte-code "IJêאבeג#â⓪דה!é①ijç" [t nil re-search-backward "^procedure\\s \\|^end[     
  137. ]" move looking-at "e"] 4))
  138.  
  139. (defun end-of-icon-defun nil (interactive) (byte-code "ijêo?à
  140. IJא!êבגdד#êהא!êוז!ç" [nil forward-char -1 re-search-forward "\\(\\s \\|^\\)end\\(\\s \\|$\\)" move forward-word forward-line 1] 5))
  141.  
  142. (defun indent-icon-exp nil "\
  143. Indent each line of the Icon grouping following point." (interactive) (byte-code "IJêIJC`CIJIJIJIJIJIJIJIJIJIJIJ`ך
  144.  ♪
  145.     ✓◆╱ə⑧èםף!)êèIJë⑤êm?à>
  146. ?à✓⇩ë⑥⓪êIJë⑥①ê①?àZmàYפë⑤?àø◆ë⑥✓êץ`§ ê`IJIJ◆%ë⑥◆ê◆@ë⑥ê◆AA@àê◆AA@ךYàô◆AA@ë⑥
  147. ê∧✓8à¥∞ êα◆8â½βף!é»פë⑥①êéLêךXà®פë⑤ê
  148. âוIJé⇦⇩Γ⓪\"àקIJë⑥
  149. ê⓪Vàϕ✓A⓪
  150. A②⓪Së⑥⓪êéרê⓪Wà✓⇧IJ✓B⓪IJ
  151. B②⓪Të⑥⓪êé∈ê
  152. @?à ⇧π
  153. ◆A@å⇧èםΣ!ê`)\"êβף!êσµ!êlâ1⇧IJé⇦⇩✓@à:⇧✓@ךYâ¥⇧Γ
  154. @fτ\"âN⇧✓@ë⑥    éÜ⇧èΦΘ!ë⑥♪êgτUë⑥ êΩ!êδ âé⇧∮
  155. @!êϕ③i âz⇧④é{⇧ך#ë⑥    éÖ⇧♪âö⇧∈!ê∩ ë⑥    éÖ⇧✓@ë⑥    )éØ⇧≡✓@àª⇧✓@[!⑤π✓⑤ë⑥    \")êg±Uå¶⇧Φ≥!àו⇧    ⑥Zë⑥    êgτUàש⇧    ⑦\\ë⑥    êi    UåΘ⇧≤`⌠ ê`\"ê    jêΦ⑧!å⇦⇩⌡⑧è§ ê`)פ#à⇦⇩÷ ê⌠ êé7).ç" [indent-stack nil contain-stack case-fold-search restart outer-loop-done inner-loop-done state ostate this-indent last-sexp at-else at-brace at-do opoint next-depth last-depth innerloop-done t icon-continued-statement-offset icon-continued-brace-offset val icon-indent-level icon-brace-offset comment-start-skip 0 forward-sexp 1 parse-partial-sexp end-of-line 4 icon-indent-line 3 forward-line /= setcar -1 skip-chars-forward "     " 123 looking-at "else\\W" icon-backward-to-noncomment icon-is-continuation-line icon-backward-to-start-of-continued-exp + icon-backward-to-start-of-if current-indentation calculate-icon-indent 125 "end\\b" delete-region beginning-of-line re-search-forward indent-for-comment] 30))
  156.